import java.util.Arrays;
import java.util.Random;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * Author:  LiuTao
 * Version: 1.0
 * Date:    2023-10-24  10:34
 */
public class Test1 {
    public static void main(String[] args) {
        Test1 test1 = new Test1();
        Random random = new Random();
        Scanner scanner = new Scanner(System.in);
        int[] num = new int[20];
        int count = 0;
        for (int i = 0; i < num.length; i++) {
            num[i] = random.nextInt(100);
        }
        System.out.println("生成的数组：" + Arrays.toString(num));
        for (int i = 0; i < num.length; i++) {
            for (int j = 0; j < num.length - i - 1; j++) {
                if (num[j] > num[j + 1]) {
                    int temp = num[j];
                    num[j] = num[j + 1];
                    num[j + 1] = temp;
                }
            }
        }
        System.out.println("排序后的数组：" + Arrays.toString(num));
        System.out.print("输入要查询的数字：");
        int n = scanner.nextInt();
        test1.contian(num,n);
    }
    void contian(int[] num, int n) {
        for(int i = 0; i < num.length; i++) {
            if(num[i] == n) {
                System.out.println(n + ":" + i);
                break;
            }
        }
    }
}